<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
	<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
		integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
	<title></title>
	<style>
		body {
			height: 4000px;
		}
	</style>
</head>

<body>
	<nav class="navbar navbar-expand-lg bg-light">
		<a href="#" class="navbar-brand">
			<img src="http://getbootstrap.com/docs/4.1/assets/brand/bootstrap-solid.svg" alt="" width="30"
				class="align-top"> Bootstrap
		</a>

		<ul class="navbar-nav">
			<li class="nav-item"><a href="#" class="nav-link">入门</a></li>
			<li class="nav-item"><a href="#" class="nav-link">布局</a></li>
			<li class="nav-item"><a href="#" class="nav-link">内容</a></li>
			<li class="nav-item dropdown">
				<a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">城市</a>
				<div class="dropdown-menu">
					<a href="#" class="dropdown-item">北京</a>
					<a href="#" class="dropdown-item">上海</a>
					<a href="#" class="dropdown-item">广州</a>
					<div class="dropdown-divider"></div>
					<a href="#" class="dropdown-item">深圳</a>
				</div>
			</li>
		</ul>

		<!-- <div class="navbar-nav">
			<a href="#" class="nav-item nav-link">入门</a>
			<a href="#" class="nav-item nav-link">布局</a>
			<a href="#" class="nav-item nav-link">内容</a>
			<a href="#" class="nav-item nav-link">组件</a>
		</div> -->
	</nav>

	<!-- 表单 -->
	<nav class="navbar bg-light mt-5">
		<a href="#" class="navbar-brand">
			<img src="http://getbootstrap.com/docs/4.1/assets/brand/bootstrap-solid.svg" alt="" width="30"
				class="align-top"> Bootstrap
		</a>

		<form action="#" class="form-inline">
			<!-- <input type="search" class="form-control mr-sm-2" placeholder="Search">
			<button type="submit" class="btn btn-outline-success mt-2 mt-sm-0">Search</button> -->

			<div class="input-group">
				<div class="input-group-prepend">
					<span class="input-group-text">@</span>
				</div>
				<input type="search" class="form-control mr-sm-2" placeholder="Search">
			</div>
			<button type="submit" class="btn btn-outline-success mt-2 mt-sm-0">Search</button>
		</form>
	</nav>

	<!-- 添加文本 -->
	<nav class="navbar navbar-expand-lg bg-light mt-5">
		<a href="#" class="navbar-brand">
			<img src="http://getbootstrap.com/docs/4.1/assets/brand/bootstrap-solid.svg" alt="" width="30"
				class="align-top"> Bootstrap
		</a>

		<ul class="navbar-nav mr-auto">
			<li class="nav-item"><a href="#" class="nav-link">入门</a></li>
			<li class="nav-item"><a href="#" class="nav-link">布局</a></li>
			<li class="nav-item"><a href="#" class="nav-link">内容</a></li>
		</ul>

		<span class="navbar-text">这是导航当中的文本</span>
	</nav>

	<!-- 颜色 -->
	<nav class="navbar navbar-expand-lg bg-dark navbar-dark mt-5">
		<a href="#" class="navbar-brand">
			<img src="http://getbootstrap.com/docs/4.1/assets/brand/bootstrap-solid.svg" alt="" width="30"
				class="align-top"> Bootstrap
		</a>

		<ul class="navbar-nav mr-auto">
			<li class="nav-item"><a href="#" class="nav-link">入门</a></li>
			<li class="nav-item"><a href="#" class="nav-link">布局</a></li>
			<li class="nav-item"><a href="#" class="nav-link">内容</a></li>
		</ul>

		<form action="#" class="form-inline">
			<input type="search" class="form-control mr-sm-2" placeholder="Search">
			<button type="submit" class="btn btn-outline-success mt-2 mt-sm-0">Search</button>
		</form>
	</nav>

	<!-- 居中容器 -->
	<div class="container">
		<nav class="navbar navbar-expand-lg bg-dark navbar-dark mt-5">
			<a href="#" class="navbar-brand">
				<img src="http://getbootstrap.com/docs/4.1/assets/brand/bootstrap-solid.svg" alt="" width="30"
					class="align-top"> Bootstrap
			</a>

			<ul class="navbar-nav mr-auto">
				<li class="nav-item"><a href="#" class="nav-link">入门</a></li>
				<li class="nav-item"><a href="#" class="nav-link">布局</a></li>
				<li class="nav-item"><a href="#" class="nav-link">内容</a></li>
			</ul>

			<form action="#" class="form-inline">
				<input type="search" class="form-control mr-sm-2" placeholder="Search">
				<button type="submit" class="btn btn-outline-success mt-2 mt-sm-0">Search</button>
			</form>
		</nav>
	</div>

	<!-- 定位 -->
	<!-- <nav class="navbar navbar-light bg-light fixed-top">
		<a href="#" class="navbar-brand">因定在顶部</a>
	</nav> -->
	<nav class="navbar navbar-light bg-light fixed-bottom">
		<a href="#" class="navbar-brand">因定在底部</a>
	</nav>
	<nav class="navbar navbar-light bg-light sticky-top">
		<a href="#" class="navbar-brand">粘性定位在浏览器的顶部</a>
	</nav>

	<!-- 响应式 -->
	<nav class="navbar navbar-expand-md bg-success navbar-dark mt-5">
		<button class="navbar-toggler" data-toggle="collapse" data-target="#navbar">
			<span class="navbar-toggler-icon"></span>
		</button>
		<div class="collapse navbar-collapse" id="navbar">
			<a href="#" class="navbar-brand">
				<img src="http://getbootstrap.com/docs/4.1/assets/brand/bootstrap-solid.svg" alt="" width="30"
					class="align-top"> Bootstrap
			</a>
			<ul class="navbar-nav mr-auto">
				<li class="nav-item"><a href="#" class="nav-link">入门</a></li>
				<li class="nav-item"><a href="#" class="nav-link">布局</a></li>
				<li class="nav-item"><a href="#" class="nav-link">内容</a></li>
			</ul>

			<form action="#" class="form-inline">
				<input type="search" class="form-control mr-sm-2" placeholder="Search">
				<button type="submit" class="btn btn-outline-light mt-2 mt-sm-0">Search</button>
			</form>
		</div>
	</nav>
	<!-- 左侧是logo，右侧是按钮 -->
	<nav class="navbar navbar-expand-md bg-success navbar-dark mt-5">
		<a href="#" class="navbar-brand">
			<img src="http://getbootstrap.com/docs/4.1/assets/brand/bootstrap-solid.svg" alt="" width="30"
				class="align-top"> Bootstrap
		</a>
		<button class="navbar-toggler" data-toggle="collapse" data-target="#navbar1">
			<span class="navbar-toggler-icon"></span>
		</button>
		<div class="collapse navbar-collapse" id="navbar1">
			<ul class="navbar-nav mr-auto">
				<li class="nav-item"><a href="#" class="nav-link">入门</a></li>
				<li class="nav-item"><a href="#" class="nav-link">布局</a></li>
				<li class="nav-item"><a href="#" class="nav-link">内容</a></li>
			</ul>

			<form action="#" class="form-inline">
				<input type="search" class="form-control mr-sm-2" placeholder="Search">
				<button type="submit" class="btn btn-outline-light mt-2 mt-sm-0">Search</button>
			</form>
		</div>
	</nav>
	<!-- 左侧是按钮，右侧是logo -->
	<nav class="navbar navbar-expand-md bg-success navbar-dark mt-5">
		<button class="navbar-toggler" data-toggle="collapse" data-target="#navbar2">
			<span class="navbar-toggler-icon"></span>
		</button>
		<a href="#" class="navbar-brand">
			<img src="http://getbootstrap.com/docs/4.1/assets/brand/bootstrap-solid.svg" alt="" width="30"
				class="align-top"> Bootstrap
		</a>
		<div class="collapse navbar-collapse" id="navbar2">
			<ul class="navbar-nav mr-auto">
				<li class="nav-item"><a href="#" class="nav-link">入门</a></li>
				<li class="nav-item"><a href="#" class="nav-link">布局</a></li>
				<li class="nav-item"><a href="#" class="nav-link">内容</a></li>
			</ul>

			<form action="#" class="form-inline">
				<input type="search" class="form-control mr-sm-2" placeholder="Search">
				<button type="submit" class="btn btn-outline-light mt-2 mt-sm-0">Search</button>
			</form>
		</div>
	</nav>





	<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
		integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
		crossorigin="anonymous"></script>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
		integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
		crossorigin="anonymous"></script>
	<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
		integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
		crossorigin="anonymous"></script>
</body>

</html>
